package com.codemonkey.lq.qd.facotry.config.event;

import com.codemonkey.lq.qd.facotry.config.ExecuteEventListener;
import com.codemonkey.lq.qd.facotry.config.ExecutionEvent;

/**
 * 仿Spring中的SmartApplicationListener(org.springframework.context.event.SmartApplicationListener)
 *	
 * Spring中的SmartApplicationListener展示的思想:
 * 	1. 扩展自最基础的ApplicationListener.
 * 	2. 增加判断本listener支持该event object的方法supportsEventType,supportsSourceType.
 * 	3. 将判断的权限下放给各个listener,这样ApplicationEventMulticaster在广播时间时只需要简单的调用即可.
 * 	4. 另外通过适配器模式的GenericApplicationListenerAdapter;
 * 	       来将原本不支持这种模式(其实SmartApplicationListener在Spring中的应用很少,哈哈.所以大部分都是这么适配过来的)的转而也支持这种方式.
 *  5. 关于适配器模式参见_BasicLearing项目下的designpatterns.adapter package.
 * 
 * @author LQ
 *
 */
public interface SmartExecuteEventListener extends ExecuteEventListener<ExecutionEvent> {
	/**
	 * Determine whether this listener actually supports the given event type.
	 * 直接抄自Spring
	 */
	boolean supportsEventType(Class<? extends ExecutionEvent> eventType);

	/**
	 * Determine whether this listener actually supports the given source type.
	 * 直接抄自Spring
	 */
	boolean supportsSourceType(Class<?> sourceType);
}
